package com.jinxinol.basic.system.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jinxinol.basic.system.domain.SysAttachment;
import com.jinxinol.basic.system.mapper.SysAttachmentMapper;
import com.jinxinol.basic.system.service.ISysAttachmentService;
import com.jinxinol.core.common.AbstractService;

/**
 * @author Automatic generation * 系统附件Service
 */
@Service
public class SysAttachmentService extends AbstractService<SysAttachment> implements ISysAttachmentService{
	@Autowired
	protected void setMapper(SysAttachmentMapper sysAttachmentMapper) {
		this.mapper = sysAttachmentMapper;
	}

	/**
	 * 系统附件插入方法 传输filelist  bus_id 业务主键ID
	 * */
	@Override
	public void insert(List<SysAttachment> filelist, Integer bus_id) {
		if (filelist!=null && bus_id != null ) {
			for (int i = 0; i < filelist.size(); i++) {
				filelist.get(i).setBus_id(bus_id);
				try {
					((SysAttachmentMapper)mapper).insert(filelist.get(i));
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}
	}
}
